import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:p_location/common/res/common_res.dart';
import 'package:p_location/net/dio_http_client.dart';
import 'package:p_location/net/net_constants.dart';
import 'package:p_location/net/net_listener_impl.dart';
import 'package:p_location/utils/device_util.dart';
import 'package:p_location/utils/string_util.dart';

class TraceModuleUtil {
  final String userName;

  final String module;

  TraceModuleUtil(this.userName, this.module);

  requestTrace(BuildContext context) async {
    String uniqueId = await DeviceUtil.getUniqueId();
    if(StringUtil.isNotEmpty(uniqueId)){
      Map<String, dynamic> params = {};
      params["userName"] = uniqueId;
      params["module"] = this.module;
      await DioHttpClient.requestPost(context, 'app/home/buriedPoint', params,
          NetListenerImpl((Response response) {}, (CommonRes errorRes) {}),
          contentType: NetConstants.POST_TYPE_FORM);
    }

  }
}
